<?php

class Antz_CMSModule extends CMSModule
{

    function getUrlByAlias($alias){
        global $gCms;
      	$manager =& $gCms->GetHierarchyManager();
      	$node =& $manager->sureGetNodeByAlias($alias);
      	$content =& $node->GetContent();
      	if (isset($content)){
        		if ($content->GetURL() != ''){
        			  return $content->GetURL();
        		}else{
                return false;
            };
      	}else{
            return false;
        };
    }

    function getUrlById($id){
        global $gCms;
      	$manager =& $gCms->GetHierarchyManager();
      	$node =& $manager->sureGetNodeById($id);
      	if(!is_object($node)) return '';
      	$content =& $node->GetContent();
      	if (isset($content)){
        		if ($content->GetURL() != ''){
        			  return $content->GetURL();
        		}else{
                return false;
            };
      	}else{
            return false;
        };
    }    
    
    function AddParamsToUrl($url, $params, $htmlentities = false){
        if($htmlentities) $amp = '&amp;';
        else $amp = '&';
        
        foreach($params as $key=>$value){
            $url = explode('?', $url);
            if(count($url)>1) $url = implode('?', $url).$amp.$key.'='.$value;
            else $url = implode('?', $url).'?'.$key.'='.$value;
        };
        return $url;
    }


    
    
}